<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<link rel="stylesheet" href="/css/certificateWeb/stationApplyFor/stationApplyFor.css">
<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<style>
    .readonly {
        cursor: not-allowed
    }
    .div-3{
        width: 100%;
        box-sizing: border-box;
        clear: both;
    }
    .span-1 {
        width: 35%;
        height: 50px;
        float: left;
        font-size: 16px;
        line-height: 50px;
        margin-left: 5px;
        margin-top: 20px;
    }
    .inp-1 {
        width: 60%;
        height: 50px;
        float: left;
        margin: 20px auto auto auto;
    }
    .but-1 {
        width: 100px;
        height: 50px;
        text-align: center;
        float: left;
        color: white;
        font-weight: bold;
        margin: 10% 10%;
        background: #e70012;
    }
    .q {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        margin-top: -8%;
        margin-right: 4%;
    }
    .q div {
        width: 20px;
        border-bottom: 2px solid red;
        margin-bottom: 5px;
    }
    .right-box {
        display: none;
        position: absolute;
        top:2%;
        right: 0;
        width: 55%;
        height: 100%;
        font-size: .32rem;
        background: #fff;
        border-left: 1px solid #ccc;
        z-index: 9999;
    }
    .right-box ul {
        margin:0;
        padding:0
    }
    .right-box li {
        height: 3rem;
        line-height: 3rem;
        border-bottom: 1px solid #ccc;
        text-align: center;

    }
    .choices {
        background: #e70012;
        color: #fff;
    }
</style>
<main id="main">
    <section>
        <!--        <div class="div_1">-->
        <!--            <ul>-->
        <!--                <li id="a"><a href="/certificate/evaluationStationApplyFor?type=4">讲师申请</a></li>-->
        <!--                <li id="b"><a href="/certificate/evaluationStationApplyFor?type=0">考评员申请</a></li>-->
        <!--                <li id="c"><a href="/certificate/evaluationStationApplyFor?type=1">考务员申请</a></li>-->
        <!--                <li id="d"><a href="/certificate/evaluationStationApplyFor?type=3">督导员申请</a></li>-->
        <!--                &lt;!&ndash;                <li id="e"><a href="/certificate/evaluationStationApplyFor?type=2">考务技术员申请</a></li>&ndash;&gt;-->
        <!--            </ul>-->
        <!--        </div>-->
        <div style="width: 100%;background:#fff;position: relative">
            <label style=" font-size: 18px; margin: 20px 0 10px 20px; font-weight: bold">专家申请</label>
            <div class="q" id="navTab">
                <div></div>
                <div></div>
                <div></div>
            </div>
            <hr/>
            <div class="right-box">
                <ul>
                    <li  onclick="checked1(0)"><a href="/certificate/aboutMobile">网站导航</a></li>
                    <li id="a" onclick="checked1(1)" ><a href="/certificate/evaluationMobileFor?type=4">讲师申请</a></li>
                    <li id="b" onclick="checked1(2)"><a href="/certificate/evaluationMobileFor?type=0">考评员申请</a></li>
                    <li id="c" onclick="checked1(3)"><a href="/certificate/evaluationMobileFor?type=1">考务员申请</a></li>
                    <li id="d" onclick="checked1(4)"><a href="/certificate/evaluationMobileFor?type=3">督导员申请</a></li>
                </ul>
            </div>
            <hr/>
            <input type="hidden" th:value="${type}" id="type" />
            <form id="formId">
            </form>
        </div>
        <div style="clear: both"></div>
    </section>
</main>
<!--<div th:include="certificateWeb/headFoot :: footer"></div>-->
<script src="/lib/jquery/jquery.min.js"></script>

<script src="/lib/jquery/jquery-migrate.min.js"></script>
<script src="/js/layui/layui.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>
<script src="/js/plugins/validate/jquery.validate.min.js"></script>

<script src="/js/plugins/validate/messages_zh.min.js"></script>

<script src="/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<!--多级导航栏插件-->
<script src="/lib/superfish/hoverIntent.js"></script>
<script src="/lib/superfish/superfish.min.js"></script>
<!--响应式弹出层和对话框插插件-->
<script src="/lib/magnific-popup/magnific-popup.min.js"></script>
<script src="/js/certificateWeb/main.js"></script>

<!--分页下拉框-->
<script type="text/javascript" src="/js/selectpage.js"></script>
<script src="/js/plugins/validate/jquery.validate.extend.js"></script>
<script type="text/javascript" src="/js/jquery-form.js"></script>
<script src="/js/jquery.citys.js"></script>
<script src="/js/plugins/validate/jquery.validate.extend.js"></script>
</body>
<script>
    var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
    $(function () {
        //用户信息查询
        selUserDetail();
        validateRule();
    });
    $.validator.setDefaults({
        submitHandler: function () {
            save();
        }
    });
    $("#navTab").on("touchstart",function () {
        $('.right-box').toggle();

    })
    function checked1(index) {
        var rightBox = document.querySelector('.right-box');
        var lis = rightBox.querySelectorAll('li');
        for (var i = 0; i < lis.length; i++) {
            if(is_mobi){
                location.href="/certificate/loginMobile"
            }
            if (i == index) {
                lis[i].toggleClass = "choices";

            } else {
                lis[i].toggleClass = "";
            }
        }

    }
    function selUserDetail() {
        var type = $('#type').val();
        console.log("type = "  ,type)
        ajaxToken("/jzApi/user/selMyCer", 'GET', {
            current: 1,
            number: 12
        }, function (r) {
            // if (r.records.length == 0){
            //     layer.alert("请先报名参加培训课程！")
            // }
            // else {

            ajaxToken("/jzApi/user/selUserDetail", "GET", {}, function (res) {
                var res = JSON.stringify(res);
                res = res.replace(/null/g, '""');
                res = JSON.parse(res);
                var b = '', c = '', d = '';
                var s = '';
                if (type == 0){
                    s = "考评员申请模板"
                }
                if (type == 1){
                    s = "考务员申请模板"
                }
                if (type == 3){
                    s = "督导员申请模板"
                }
                if (type == 4){
                    s = "讲师申请模板"
                }
                $.ajax({
                    url: "/jzApi/index/selNewsList",
                    type: 'GET',
                    data: {
                        firstColumn: '证书考试门户',
                        columnName: s,
                        current: 1,
                        number: 1
                    },
                    success: function (res1) {
                        if (res1.data.pages == 0) {
                            c = '<a >暂无数据</a>';
                        } else {
                            console.log("aaa = " , res1)
                            var list = res1.data.records;
                            list.forEach(function (item, index) {
                                c += '<a target="_blank" style="color: #0000ff" download href="' + item.files + '">' + item.title + '</a>'
                            });
                            if (res.sex != '' && res.sex != null && res.sex != 0) {
                                if (res.sex == 1) {
                                    b = '<select id="sex" readonly name="sex" class="form-control inp-1 readonly">' +
                                        '                        <option value="1" select="">男</option>' +
                                        '                    </select>'
                                } else {
                                    b = '<select id="sex" readonly name="sex" class="form-control inp-1 readonly">' +
                                        '                        <option value="2" select="">女</option>' +
                                        '                    </select>'
                                }
                            } else {
                                b = '<select id="sex" name="sex" class="form-control inp-1">' +
                                    '                        <option value="">请选择</option>' +
                                    '                        <option value="1">男</option>' +
                                    '                        <option value="2">女</option>' +
                                    '                    </select>'
                            }
                            if (res.province != '' && res.province != null) {
                                if (res.city != '' && res.city != null) {
                                    d = '<input class="form-control inp-1" style="width: 150px" readonly id="province" name="province" value="' + res.province + '"/>' +
                                        '<input class="form-control inp-1" style="width: 150px" id="city" readonly name="city" value="' + res.city + '"/>' +
                                        '<input class="form-control inp-1" style="width: 150px" id="district" readonly name="district" value="' + res.district + '"/>'
                                } else {
                                    d = '<input class="form-control inp-1" style="width: 150px" readonly id="province" name="province" value="' + res.province + '"/>' +
                                        '<input class="form-control inp-1" style="width: 150px;display: none" id="city" readonly name="city" value="' + res.city + '"/>' +
                                        '<input class="form-control inp-1" style="width: 150px" id="district" readonly name="district" value="' + res.district + '"/>'
                                }

                            } else {
                                d = '<select class="form-control inp-1" id="province" name="province" style="width: 150px;height: 50px"></select>' +
                                    '<select class="form-control inp-1" id="city" name="city" style="width: 150px;height: 50px"></select>' +
                                    '<select class="form-control inp-1" id="district" name="district" style="width: 150px;height: 50px"></select>'
                            }
                            var a = '<span style="height: 50px;margin-left: 10px;font-size: 16px;line-height: 50px;color: #D52525;">注意：如要修改已有的基本信息请到个人资料修改' +

                                '                        </span>' +
                                '<a style="border:1px solid #ff751a ;padding: 2px 4px;color:#ff751a;margin-left:10px" href="/certificate/editMy">去修改</a>'+
                                '<div style="text-align: center;border-bottom: 1px solid #CFCFCF">基本信息</div>' +
                                '                <div style="margin-left:290px;" id="headPortrait1">' +
                                '                    <img id="test1" src="' + res.headPortrait + '" style="width: 147px;height:206px;margin-top: 20px"/>' +
                                '                </div>' +
                                '                <div class="div-3" id="headPortrait">' +
                                '                    <label class="span-1">专家寸照<span style="color: #D52525">*</span>：</label>' +
                                '                    <button type="button" class="btn inp-1" style="margin-top: 20px" id="btnUpload1">' +
                                '                        <i class="fa fa-cloud"></i>上传寸照' +
                                '                    </button>' +
                                '                    <input type="text" style="opacity:0;width: 1px;" id="img" name="imgUrl"' +
                                '                           value="' + res.headPortrait + '"/>' +
                                '                    <label class="wd160">注意：请上传小于1M的寸照</label>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">姓名<span style="color: #D52525">*</span>：</label>' +

                                '                    <input id="name" name="name"  value="' + res.name + '" class="form-control inp-1 read" placeholder="请输入姓名"' +
                                '                           type="text">' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">性别<span style="color: #D52525">*</span>：</label>' + b + '</div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">出生年月<span style="color: #D52525">*</span>：</label>' +
                                '                    <input id="dateOfBirth" name="dateOfBirth" class="form-control inp-1"' +
                                '                           type="text" placeholder="请输入出生年月" value="' + res.dateOfBirth + '">' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">民族<span style="color: #D52525">*</span>：</label>' +
                                '                    <select id="nation" name="nation" class="form-control inp-1">' +
                                '                        <option value="">请选择</option>' +
                                '                        <option value="汉族">汉族</option>' +
                                '                        <option value="蒙古族">蒙古族</option>' +
                                '                        <option value="回族">回族</option>' +
                                '                        <option value="藏族">藏族</option>' +
                                '                        <option value="维吾尔族">维吾尔族</option>' +
                                '                        <option value="苗族">苗族</option>' +
                                '                        <option value="彝族">彝族</option>' +
                                '                        <option value="壮族">壮族</option>' +
                                '                        <option value="布依族">布依族</option>' +
                                '                        <option value="朝鲜族">朝鲜族</option>' +
                                '                        <option value="满族">满族</option>' +
                                '                        <option value="侗族">侗族</option>' +
                                '                        <option value="瑶族">瑶族</option>' +
                                '                        <option value="白族">白族</option>' +
                                '                        <option value="土家族">土家族</option>' +
                                '                        <option value="其他">其他</option>' +
                                '                    </select>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">学历<span style="color: #D52525">*</span>：</label>' +
                                '                    <select id="education" name="education" class="form-control inp-1">' +
                                '                        <option value="">请选择</option>' +
                                '                        <option value="博士后">博士后</option>' +
                                '                        <option value="博士">博士</option>' +
                                '                        <option value="研究生">研究生</option>' +
                                '                        <option value="本科">本科</option>' +
                                '                        <option value="大专">大专</option>' +
                                '                        <option value="大专以下">大专以下</option>' +
                                '                    </select>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">专业<span style="color: #D52525">*</span>：</label>' +
                                '                    <input id="major" name="major" class="form-control inp-1" placeholder="请输入专业" value="' + res.major + '"/>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">政治面貌<span style="color: #D52525">*</span>：</label>' +
                                '                    <select id="politicalAffiliation" name="politicalAffiliation" class="form-control inp-1">' +
                                '                        <option value="">请选择</option>' +
                                '                        <option value="群众">群众</option>' +
                                '                        <option value="中国共青团团员">中国共青团团员</option>' +
                                '                        <option value="中国共产党党员">中国共产党党员</option>' +
                                '                        <option value="无党派民主人士">无党派民主人士</option>' +
                                '                        <option value="民主党派人士">民主党派人士</option>' +
                                '                    </select>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">职务职称<span style="color: #D52525">*</span>：</label>' +
                                '                    <input id="officialCapacity" name="officialCapacity" class="form-control inp-1"' +
                                '                           value="' + res.officialCapacity + '"  placeholder="请输入职务职称"/>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">身份证号码<span style="color: #D52525">*</span>：</label>' +
                                '                    <input id="idNumber"  value="' + res.idNumber + '" name="idNumber" class="form-control inp-1"' +
                                '                           placeholder="请输入身份证号码"/>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">QQ：</label>' +
                                '                    <input id="QQ" name="QQ"  value="' + res.qq + '"' +
                                '                           class="form-control inp-1" placeholder="请输入QQ"/>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">email：</label>' +
                                '                    <input id="email" name="email"  value="' + res.email + '"' +
                                '                           type="email" class="form-control inp-1" placeholder="请输入email"/>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">单位名称<span style="color: #D52525">*</span>：</label>' +
                                '                    <input id="orgName" name="orgName"  value="' + res.orgName + '"' +
                                '                           class="form-control inp-1" placeholder="请输入单位名称"/>' +
                                '                </div>' +
                                '                <div class="div-3" id="adre">' +
                                '                    <label class="span-1">现居住地省市区<span style="color: #D52525">*</span>：</label>' +
                                d +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">现居住详细地址<span style="color: #D52525">*</span>：</label>' +
                                '                    <textarea id="liveAddress" name="liveAddress"' +
                                '                              class="form-control inp-1"' +
                                '                              style="height:70px;float: left;margin: 20px auto auto auto;"' +
                                '                              placeholder="请输入现居住详细地址">' + res.liveAddress + '</textarea>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">学习、工作经历<span style="color: #D52525"></span>：</label>' +
                                '                    <textarea id="experience" name="experience"' +
                                '                              class="form-control"' +
                                '                              style="width:95%;height:320px;float: left;margin: 20px auto auto 10px;"' +
                                '                              placeholder="请输入学习、工作经历">' + res.experience + '</textarea><div style="clear:both"></div>' +
                                '                </div>' +
                                '<div style="text-align: center;border-bottom: 1px solid #CFCFCF;margin-top: 10px">专家信息</div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">专家类型<span style="color: #D52525">*</span>：</label>' +
                                /* '                    <select id="type" name="type" class="form-control inp-1">' +
                                 '                        <option value="">请选择</option>' +
                                 '                        <option value="0">考评员</option>' +
                                 '                        <option value="1">考务员</option>' +
                                 '                        <option value="2">考务技术员</option>' +
                                 '                        <option value="3">督导员</option>' +
                                 '                        <option value="4">讲师</option>' +
                                 '                    </select>' +*/
                                '<input type="hidden" name="type" id="types" />'+
                                '<input type="text" readonly id="type1" class="form-control inp-1" />'+
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">负责证书<span style="color: #D52525">*</span>：</label>' +
                                '                    <select id="profileId" name="profileId" class="form-control inp-1">' +
                                '                    </select>' +
                                '                </div>' +
                                // '                <div class="div-3">' +
                                // '                    <label class="span-1">知识点领域<span style="color: #D52525">*</span>：</label>' +
                                // '                    <select name="kpointsId" id="kpointsId" class="form-control inp-1"></select>' +
                                // '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">个人荣誉<span style="color: #D52525"></span>：</label>' +
                                '                    <textarea id="honor" maxlength="500" name="honor"' +
                                '                              class="form-control"' +
                                '                              style="width: 95%;height:250px;float: left;margin: 20px auto auto 10px;"' +
                                '                              placeholder="请输个人荣誉"></textarea><div style="clear:both"></div>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">附件<span style="color: #D52525">*</span>：</label>' +
                                '                    <button type="button" class="btn inp-1" style="margin-top: 20px" id="btnUpload">' +
                                '                        <i class="fa fa-cloud"></i>上传文件' +
                                '                    </button>' +
                                '                    <input type="text" style="opacity:0;width: 1px;" id="fileUrl" name="fileUrl"/>' +
                                '                    <span id="test"></span>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <label class="span-1">附件模板下载：</label>' +
                                '                    <label style="height: 50px;float: left;margin: 20px 10px auto auto;font-size: 16px;line-height: 50px;">' +
                                c +
                                '                    </label>' +
                                '                </div>' +
                                '                <div class="div-3">' +
                                '                    <button class="form-control but-1" id="send" type="submit">提交</button>' +
                                '                <button class="form-control but-1" type="button" onclick="saveCao()">保存草稿</button>' +
                                '                </div>';
                            $("#formId").html(a);
                            $('#types').val(type);
                            if (type == 0){
                                $('#type1').val("考评员");
                                $('#a').removeClass("this");
                                $('#b').addClass("this");
                                $('#c').removeClass("this");
                                $('#d').removeClass("this");
                                $('#e').removeClass("this");
                            }else if (type == 1) {
                                $('#type1').val("考务员");
                                $('#a').removeClass("this");
                                $('#b').removeClass("this");
                                $('#c').addClass("this");
                                $('#d').removeClass("this");
                                $('#e').removeClass("this");
                            }else if (type == 2){
                                $('#type1').val("考务技术员");
                                $('#a').removeClass("this");
                                $('#b').removeClass("this");
                                $('#c').removeClass("this");
                                $('#d').removeClass("this");
                                $('#e').addClass("this");
                            }else if (type == 3){
                                $('#type1').val("督导员");
                                $('#a').removeClass("this");
                                $('#b').removeClass("this");
                                $('#c').removeClass("this");
                                $('#d').addClass("this");
                                $('#e').removeClass("this");
                            }else if (type == 4) {
                                $('#type1').val("讲师");
                                $('#a').addClass("this");
                                $('#b').removeClass("this");
                                $('#c').removeClass("this");
                                $('#d').removeClass("this");
                                $('#e').removeClass("this");

                            }
                            $.ajax({
                                url: '/jzApi/certificates/selProfileFill',
                                success: function (res) {
                                    var list = res.data;
                                    var opt = '<option value="">请选择</option>';
                                    for (var i = 0; i < list.length; i++) {
                                        opt += '<option value="' + list[i].id + '">' + list[i].name + '</option>'
                                    }
                                    $("#profileId").html(opt);
                                    //获取草稿
                                    ajaxToken("/jzApi/experts/selCao", "POST", {type:type}, function (res) {
                                        if(res!=null){
                                            $("#profileId").val(res.profileId);
                                            $("#honor").val(res.honor);
                                            $("#fileUrl").val(res.enclosure);
                                            $("#test").html(subFileName(res.enclosure));
                                        }
                                    });
                                }
                            });

                            //省市区联动
                            $('#adre').citys({
                                province: res.province,
                                city: res.city,
                                district: res.district
                            });
                            if (res.headPortrait != '' && res.headPortrait != null) {
                                $("#headPortrait").css("display", "none");
                                $("#headPortrait1").css("display", "block")
                            } else {
                                $("#headPortrait").css("display", "block");
                                $("#headPortrait1").css("display", "none")
                            }
                            if (res.name != '' && res.name != null) {
                                $("#name").attr("readonly", "readonly");
                                $("#name").addClass("readonly")
                            }
                            if (res.dateOfBirth != '' && res.dateOfBirth != null) {
                                $("#dateOfBirth").attr("readonly", "readonly");
                                $("#dateOfBirth").addClass("readonly")
                            } else {
                                layui.use('laydate', function () {
                                    var laydate = layui.laydate;
                                    laydate.render({
                                        elem: '#dateOfBirth' //指定元素
                                    });
                                });
                            }
                            if (res.nation != '' && res.nation != null) {
                                $("#nation").val(res.nation);
                                $("#nation").attr("readonly", "readonly");
                                $("#nation").addClass("readonly");
                                $("#nation").attr("onfocus", "this.defaultIndex=this.selectedIndex");
                                $("#nation").attr("onchange", "this.selectedIndex=this.defaultIndex");
                            }
                            if (res.education != '' && res.education != null) {
                                $("#education").val(res.education);
                                $("#education").attr("readonly", "readonly");
                                $("#education").addClass("readonly");
                                $("#education").attr("onfocus", "this.defaultIndex=this.selectedIndex");
                                $("#education").attr("onchange", "this.selectedIndex=this.defaultIndex");
                            }
                            if (res.major != '' && res.major != null) {
                                $("#major").attr("readonly", "readonly");
                                $("#major").addClass("readonly")
                            }
                            if (res.politicalAffiliation != '' && res.politicalAffiliation != null) {
                                $("#politicalAffiliation").val(res.politicalAffiliation);
                                $("#politicalAffiliation").attr("readonly", "readonly");
                                $("#politicalAffiliation").addClass("readonly");
                                $("#politicalAffiliation").attr("onfocus", "this.defaultIndex=this.selectedIndex");
                                $("#politicalAffiliation").attr("onchange", "this.selectedIndex=this.defaultIndex");
                            }
                            if (res.officialCapacity != '' && res.officialCapacity != null) {
                                $("#officialCapacity").attr("readonly", "readonly");
                                $("#officialCapacity").addClass("readonly")
                            }
                            if (res.idNumber != '' && res.idNumber != null) {
                                $("#idNumber").attr("readonly", "readonly");
                                $("#idNumber").addClass("readonly")
                            }
                            if (res.qq != '' && res.qq != null) {
                                $("#QQ").attr("readonly", "readonly");
                                $("#QQ").addClass("readonly")
                            }
                            if (res.email != '' && res.email != null) {
                                $("#email").attr("readonly", "readonly");
                                $("#email").addClass("readonly")
                            }
                            if (res.orgName != '' && res.orgName != null) {
                                $("#orgName").attr("readonly", "readonly");
                                $("#orgName").addClass("readonly")
                            }

                            if (res.liveAddress != '' && res.liveAddress != null) {
                                $("#liveAddress").attr("readonly", "readonly");
                                $("#liveAddress").addClass("readonly")
                            }
                            if (res.experience != '' && res.experience != null) {
                                $("#experience").attr("readonly", "readonly");
                                $("#experience").addClass("readonly")
                            }

                            layui.use(['upload'], function () {
                                var upload = layui.upload;
                                upload.render({
                                    elem: '#btnUpload', //绑定元素
                                    url: '/jzApi/utils/fileImprot', //上传接口
                                    size: 1024 * 4,
                                    accept: 'file',
                                    done: function (r) {
                                        $("#fileUrl").val(r.data);
                                        $("#test").html(subFileName(r.data));
                                    },
                                    error: function (r) {
                                        layer.msg(r.msg);
                                    }
                                });
                                upload.render({
                                    elem: '#btnUpload1', //绑定元素
                                    url: '/jzApi/utils/fileImprot', //上传接口
                                    // auto: false,
                                    accept: 'images', //只允许上传图片
                                    acceptMime: 'image/*', //只筛选图片
                                    size: 1024, //限定大小
                                    done: function (r) {
                                        $("#img").val(r.data);
                                        $("#test1").attr("src", r.data);
                                        $("#test1").css({"width": "147px", "height": "206px", "margin-top": "20px"});
                                    },
                                    error: function (r) {
                                        layer.msg(r.msg);
                                    }
                                });
                            });

                        }
                    }
                })

            })

            // }

        })
    }






    function save() {
        ajaxTokenForm("/jzApi/experts/addExpert", "POST", $('#formId').serialize(), function (res) {
            if (res != null){
                if(res.code == "40013" || res.code == 40013){
                    layer.confirm("您已申请过，可去个人中心查看记录", {
                        btn: ['查看', '取消']
                    }, function (index, layero) {
                        location.href = "/certificate/expertRecordList"
                    })
                }
            }else {
                layer.alert('申请成功，请等待审核');
                setTimeout(function () {
                    location.href = "/certificate/expertRecordList"
                }, 1000);
            }
        })
    }

    function saveCao() {
        if($('#profileId').val()==""){
            layer.alert('负责证书不能为空！');
            return false;
        }
        ajaxTokenForm("/jzApi/experts/saveCaoExpert", "POST", $('#formId').serialize(), function (res) {
            if (res != null){
                if(res.code == "40013" || res.code == 40013){
                    layer.confirm("您已申请过，可去个人中心查看记录", {
                        btn: ['查看', '取消']
                    }, function (index, layero) {
                        location.href = "/certificate/expertRecordList"
                    })
                }
            }else {
                layer.msg("保存成功", {offset: "rb"});
            }
        })
    }

    $(function () {

    });

    function validateRule() {
        var icon = "<i class='fa fa-times-circle'></i>";
        $("#formId").validate({
            rules: {
                /*imgUrl: {
                    required: true
                },*/
                type: {
                    required: true
                },
                profileId: {
                    required: true
                },
                // kpointsId: {
                //     required: true
                // },
                name: {
                    required: true
                },
                sex: {
                    required: true
                },
                dateOfBirth: {
                    required: true
                },
                nation: {
                    required: true
                },
                education: {
                    required: true
                },
                major: {
                    required: true
                },
                politicalAffiliation: {
                    required: true
                },
                officialCapacity: {
                    required: true
                },
                idNumber: {
                    required: true,
                    isIdentity: true
                },
                orgName: {
                    required: true
                },
                liveAddress: {
                    required: true,
                    maxlength: 100
                },
                province: {
                    required: true
                },
                //city: {
                //   required: true
                //  },
                // district: {
                //   required: true
                //},
                // experience: {
                //     required: true,
                //     maxlength: 800
                // },
                fileUrl: {
                    required: true
                }
            },
            messages: {
                /*imgUrl: {
                    required: icon + "请上传寸照"
                },*/
                type: {
                    required: icon + "请选择专家类型"
                },
                profileId: {
                    required: icon + "请选择证书"
                },
                // kpointsId: {
                //     required: icon + "请选择知识点"
                // },
                name: {
                    required: icon + "请输入姓名"
                },
                sex: {
                    required: icon + "请选择性别"
                },
                dateOfBirth: {
                    required: icon + "请选择出生日期"
                },
                nation: {
                    required: icon + "请选择民族"
                },
                education: {
                    required: icon + "请选择学历"
                },
                major: {
                    required: icon + "请输入专业"
                },
                politicalAffiliation: {
                    required: icon + "请输入政治面貌"
                },
                officialCapacity: {
                    required: icon + "请输入职务职称"
                },
                idNumber: {
                    required: icon + "请输入身份证号"
                },

                orgName: {
                    required: icon + "请输入所在单位名称"
                },
                liveAddress: {
                    required: icon + "请输入现居住地址"
                },
                // experience: {
                //     required: icon + "请输入经历"
                // },
                fileUrl: {
                    required: icon + "请上传附件"
                }

            }
        })
    }

</script>
</html>